//菜单收缩与扩展
function show(title) {
	let currentMenu = document.getElementById(title);
	let currentStatus = currentMenu.style.display;
	currentMenu.style.display = currentStatus == "" ? "none" : "";
}
//获取原始图片路径
function showImg() {
	let createurl = document.querySelector("#fruit");
	let cu = document.querySelector("#msg1");
	cu.innerHTML = createurl.getAttribute("src");

}
//获取喜欢的水果
function getFruit() {
	let nm = document.getElementsByName("enjoy");
	let val = [];
	let msg2 = document.getElementById("msg2");
	for (i in nm) {
		if (nm[i].checked) {
			val.push(nm[i].value);
		}
	}
	msg2.innerHTML = "你喜欢的水果是：" + val + "。";

}
//创建图片
function createImg() {
	let msg3 = document.createElement("img");
	msg3.setAttribute("src", "img/grape.jpg");
	document.getElementById("msg3").appendChild(msg3);


}
//克隆图片
function cloneImg() {
	let fruit = document.getElementById("fruit");
	let msg4 = fruit.cloneNode(true);
	document.getElementById("msg4").appendChild(msg4);

}
//改变图片
function changeImg() {
	document.getElementById("fruit").src = "img/grape.jpg";

}
//删除图片
function removeImg() {
	let msgf = document.getElementById("fruit").removeAttribute("src");
}
//操作样式1
function changeCss1() {
	document.getElementById("fruit").border = "5";
	document.getElementById("fruit").style = "border-color:red;";


}
//操作样式2
function changeCss2() {
	let fd = document.getElementsByTagName("fieldset");
	for (let i = 0; i < fd.length; i++) {
		fd[i].style.backgroundColor = "green";
	}

}
